// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import VueQuillEditor from 'vue-quill-editor'
// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'
import store from './store'

Vue.use(ElementUI)
// Vue.use(VueQuillEditor)
Vue.prototype.axios = axios
axios.defaults.headers['SessionId'] = 'fd4eda20-e3fd-4abd-8031-427fd283b383'
Vue.config.productionTip = false

axios.interceptors.request.use(
  config => {
    // store.dispatch('setloading', true)
    return config;
  },
  err => {
    return Promise.reject(err);
  });

axios.interceptors.response.use(function(response){
  //对响应数据做些事
  let data = response.data
  // setTimeout(()=>{
  //   store.dispatch('setloading', false)
  // },1000)
  if(data.code == 403){
    router.push('/')
  }
  return response;
},function(error){
  //请求错误时做些事
  console.log(error.response)
  return Promise.reject(error);
})


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})
